<template>
  <div>
    <supertable
      class="LoginLogTable"
      :tableData="tableData"
      :headerData="headerData"
      :isoperation="false"
      :height="1000"
      :isexpand="true"
    >
      <template v-slot:btnSolt>
        <div class="SendbtnSolt">
          <el-button
            type="success"
            icon="el-icon-search"
            size="mini"
            @click="add()"
            >搜索</el-button
          >
          <el-button
            type="primary"
            icon="el-icon-refresh"
            size="mini"
            @click="modification()"
            >重置</el-button
          >
          <el-button type="danger" icon="el-icon-delete" size="mini"
            >清除</el-button
          >
        </div>
      </template>
    </supertable>
  </div>
</template>

<script>
import supertable from "@/components/supertable";
import { loginLogList } from "@/api/LoginLog";
export default {
  data() {
    return {
      tableData: [],
      headerData: [
        {
          prop: "user",
          label: "用户",
          width: "",
        },
        {
          prop: "IP",
          label: "IP",
          width: "",
        },
        {
          prop: "LogName",
          label: "日志名称",
          width: "",
        },
         {
          prop: "time",
          label: "时间",
          width: "",
        },
      ],
    };
  },
  mounted() {
    let _self = this;
    _self.loginLogListFn();
  },
  methods: {
    loginLogListFn() {
      let _self = this;
      let data = {
        page: "1",
        limit: "20",
      };
      loginLogList(data).then((res) => {
        console.log(res);
        if (res.code == 20000) {
          for (let item of res.data.records) {
            _self.tableData.push({
              user: item.userName,
              IP: item.ip,
              LogName:item.logname,
              time:item.createTime
            });
          }
        }
      });
    },
  },
  components: {
    supertable,
  },
};
</script>

<style scoped>
.LoginLogTable {
  margin: 20px;
}
.SendbtnSolt {
  margin: 20px 0;
}
</style>